import request from "@/plugins/request";

var pre = "/property";

if (process.env.NODE_ENV !== "development") {
  pre = '/api/sa/empl-care' + pre;
}

export function switchData(obj) {
  let str = '?';
  for (let key in obj) {
    str += `${key}=${obj[key]}&`
  }
  return str.slice(0, -1);
}

export function getAppUserProperty() {
  return request({
    url: `${pre}/getAppUserProperty`,
    method: "get",
  });
}


export function savePropertyOrder(data) {
  return request({
    url: `${pre}/savePropertyOrder`,
    method: "post",
    data,
  });
}


export function getListByPropertyId(propertyId) {
  return request({
    url: `${pre}/getListByPropertyId?propertyId=${propertyId}`,
    method: "get",
  });
}


export function getConfigData(propertyId, srvItemId) {
  return request({
    url: `${pre}/getConfigData?propertyId=${propertyId}&srvItemId=${srvItemId}`,
    method: "get",
  });
}

export function getTimeSlots(srvItemId, selDate) {
  return request({
    url: `${pre}/getTimeSlots?srvItemId=${srvItemId}&selDate=${selDate}`,
    method: "get",
  });
}


// 查询服务订单详情
export function getPropertyServiceOrderInfo(srvOrderId) {
  return request({
    url: `${pre}/query?srvOrderId=${srvOrderId}`,
    method: 'get',
  });
}

export function getUserPhone() {
  return request({
    url: `${pre}/getUserPhone`,
    method: "get",
  });
}

export function getPropertyConfig() {
  return request({
    url: `${pre}/getPropertyConfig`,
    method: "get",
  });
}

